﻿using Microsoft.EntityFrameworkCore.Design;
using Microsoft.EntityFrameworkCore;

namespace Identity_JWT.Data
{
    public class DbContextDesignTimeFactory : IDesignTimeDbContextFactory<ApplicationDbContext>
    {
        public ApplicationDbContext CreateDbContext(string[] args)
        {
            DbContextOptionsBuilder<ApplicationDbContext> builder = new DbContextOptionsBuilder<ApplicationDbContext>();
            string? mySqlConStr = "server=82.157.168.172;database=Identity_JWTDemo;uid=feng;pwd=123456Feng!;charset=utf8;";
            builder.UseMySql(mySqlConStr, ServerVersion.AutoDetect(mySqlConStr))
                   .EnableDetailedErrors().EnableSensitiveDataLogging();
            return new ApplicationDbContext(builder.Options);
        }
    }
}
